package com.sk.waste.app.views

import android.app.Dialog
import android.content.Context
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import android.widget.Button
import android.widget.FrameLayout
import android.widget.ImageButton
import android.widget.LinearLayout
import android.widget.TextView
import com.lc.smc.lib.bases.LCObject
import com.lc.smc.lib.interfaces.LCInterface.LcOnPnButtonClickLitener
import com.sk.waste.app.R

/**
 *  @time 2025/4/29  17:13
 *  @desc vip购买提示
 */
class VipNoticeDialog(context: Context?) : LCObject() {
    private val mDialog: Dialog?
    private val bttCancle: ImageButton
    private val leftButton: Button
    private val rightButton: Button
    private val rootView: LinearLayout
    var buttonOnClickListener: LcOnPnButtonClickLitener? = null

    init {
        mDialog = Dialog(context!!, R.style.lc_style_dialog)
        val inflater = LayoutInflater.from(context)
        val view = inflater.inflate(R.layout.view_vipnotice_dialog, null)
        bttCancle = view.findViewById<View>(R.id.dialog_cancle) as ImageButton
        leftButton = view.findViewById<View>(R.id.dialog_left_btt) as Button
        rightButton = view.findViewById<View>(R.id.dialog_right_btt) as Button
        rootView = view.findViewById<View>(R.id.dialog_root_view) as LinearLayout
        bttCancle.setOnClickListener {
            cancel()
        }
        leftButton.setOnClickListener {
            cancel()
            if (buttonOnClickListener != null)
                buttonOnClickListener!!.onNegetiveClick()
        }
        rightButton.setOnClickListener {
            cancel()
            if (buttonOnClickListener != null)
                buttonOnClickListener!!.onPositiveClick()
        }
        mDialog.setCancelable(false)
        mDialog.setContentView(view)
    }

    /**
     * 显示
     */
    fun show() {
        mDialog?.show()
    }

    fun cancel() {
        mDialog!!.cancel()
    }
    fun setOnclickListener(onclick: LcOnPnButtonClickLitener) {
        buttonOnClickListener = onclick
    }
}